package com.lrkj.back.service.impl;

import java.util.List;
import java.util.Map;

import com.lrkj.back.entity.TbModule;
import com.lrkj.back.mapper.TbModuleMapper;
import com.lrkj.back.service.TbModuleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import cn.com.cbons.mamisay.parent.db.api.DBInterface;
import cn.com.cbons.mamisay.parent.exception.DBException;
import cn.com.cbons.mamisay.parent.service.base.ParentServiceImpl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;

@Transactional
@Service("moduleService")
public class TbModuleServiceImpl extends ParentServiceImpl<TbModule> implements TbModuleService {
    @Autowired
    private TbModuleMapper tbModuleMapper;

    @Override
    protected DBInterface<TbModule> getDao() throws DBException {
        return tbModuleMapper;
    }

    @Override
    public PageInfo<TbModule> findAllTbModule(Map<String, Object> map) throws DBException {
        PageHelper.startPage(Integer.valueOf(map.get("pageNo").toString()),
                Integer.valueOf(map.get("pageSize").toString()));
        List<TbModule> mfList = tbModuleMapper.findAllTbModule(map);
        PageInfo<TbModule> page = new PageInfo<TbModule>(mfList);
        return page;
    }

    @Override
    public List<TbModule> findMyModules(Integer empId) throws DBException {
        return tbModuleMapper.findMyModules(empId);
    }

    @Override
    public List<TbModule> findAllTbModules(Map<String, Object> map) throws DBException {
        List<TbModule> mfList = tbModuleMapper.findAllTbModule(map);
        return mfList;
    }

    @Override
    public List<TbModule> findAdminModule() throws DBException {
        return tbModuleMapper.findAdminModule();
    }

}
